<?php
class Webkul_Marketplacepartner_SendmailController extends Mage_Core_Controller_Front_Action
{
    public function indexAction(){ 
		/*require_once('recaptchalib.php');
		$privatekey = Mage::getStoreConfig('partners/partners_options/recaptchaprivate');
		$resp = recaptcha_check_answer($privatekey,$_SERVER["REMOTE_ADDR"],$_POST["recaptcha_challenge_field"],$_POST["recaptcha_response_field"]);
		if (!$resp->is_valid){
		// What happens when the CAPTCHA was entered incorrectly
		//die ("The reCAPTCHA wasn't entered correctly. Go back and try it again." ."(reCAPTCHA said: " . $resp->error . ")");
		} 
		else {*/
			// Your code here to handle a successful verification
			$emailTemplate = Mage::getModel('core/email_template')->loadDefault('querypartner_email');
			$emailTemplateVariables = array();
			$mail=Mage::getModel('customer/customer')->load($_POST['seller-id']);
			$emailTemplateVariables['myvar1'] =$mail->getName();
			$sellerEmail = $mail->getEmail();
			$emailTemplateVariables['myvar3'] =Mage::getModel('catalog/product')->load($_POST['product-id'])->getName();
			$emailTemplateVariables['myvar4'] =$_POST['ask'];
			$emailTemplateVariables['myvar5'] =$_POST['email'];
			$myname =Mage::getSingleton('customer/session')->getCustomer()->getName() ;
			if(strlen($myname)<2){$myname="Guest";}
			$processedTemplate = $emailTemplate->getProcessedTemplate($emailTemplateVariables);
			$emailTemplate->setSenderName($myname);
			$emailTemplate->setSenderEmail($_POST['email']);
			$emailTemplate->send($sellerEmail,$myname,$emailTemplateVariables);
		//}  
		//echo json_encode(true);
    }
}